/**
 *Copyright (c) 2024 watereyes
 * safetymanagement is licensed under Mulan PubL v2.
 * You can use this software according to the terms and conditions of the Mulan
 * PubL v2.
 * You may obtain a copy of Mulan PubL v2 at:
 *          http://license.coscl.org.cn/MulanPubL-2.0
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PubL v2 for more details.
 */
package com.koron.report.mapper;

import com.koron.report.bean.*;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;
import java.util.Map;

public interface DataAnalysisMapper {

    /**
     * 统计网格的，专门用来处理粤港供水的
     *
     * @param nomarlDangerCount
     * @param importantDangerCount
     * @param managerDangerCount
     * @param deviceDangerCount
     * @param meterialDangerCount
     * @param personDangerCount
     * @param GoodsDangerCount
     * @param enviropmentDangerCount
     * @param updateTimeStart
     * @param updateTimeEnd
     * @param codeList
     * @return
     */
    DangerAnalysis queryCountDangerByGrid(@Param("nomarlDangerCount") String nomarlDangerCount, @Param("importantDangerCount") String importantDangerCount,
                                          @Param("managerDangerCount") String managerDangerCount, @Param("deviceDangerCount") String deviceDangerCount, @Param("meterialDangerCount") String meterialDangerCount,
                                          @Param("personDangerCount") String personDangerCount, @Param("GoodsDangerCount") String GoodsDangerCount,
                                          @Param("enviropmentDangerCount") String enviropmentDangerCount, @Param("updateTimeStart") Date updateTimeStart, @Param("updateTimeEnd") Date updateTimeEnd, @Param("codeList") List<String> codeList);

    /**
     * 统计隐患的整改情况，按网格统计专门用来处理粤港供水的
     *
     * @param unreformCount
     * @param alreadyReformCount1
     * @param reformingCount
     * @param alreadyReformCount2
     * @param refuseReformCount
     * @param updateTimeStart
     * @param updateTimeEnd
     * @param codeList
     * @return
     */
    DangerAnalysis queryCountDangerPrecautionByGrid(@Param("unreformCount") String unreformCount, @Param("alreadyReformCount1") String alreadyReformCount1,
                                                    @Param("reformingCount") String reformingCount, @Param("alreadyReformCount2") String alreadyReformCount2,
                                                    @Param("refuseReformCount") String refuseReformCount, @Param("updateTimeStart") Date updateTimeStart, @Param("updateTimeEnd") Date updateTimeEnd, @Param("codeList") List<String> codeList);

    DangerAnalysis queryCountDangerPrecautionByGrid1(@Param("updateTimeStart") Date updateTimeStart, @Param("updateTimeEnd") Date updateTimeEnd, @Param("codeList") List<String> codeList);


    /**
     * 危险源关于风险统计分析
     *
     * @param updateTimeStart
     * @param updateTimeEnd
     * @param codeList
     * @return
     */
    LocalHazarsSourceAnalysis queryCountRiskHazardSource(@Param("updateTimeStart") Date updateTimeStart, @Param("updateTimeEnd") Date updateTimeEnd, @Param("codeList") List<String> codeList);

    /**
     * 统计风险
     *
     * @param updateTimeStart
     * @param updateTimeEnd
     * @param codeList
     * @return
     */
    LocalHazarsSourceAnalysis queryCountRiskHazardSourceByGrid(@Param("updateTimeStart") Date updateTimeStart, @Param("updateTimeEnd") Date updateTimeEnd, @Param("codeList") List<String> codeList);

    /**
     * 危险源关于重大危险源统计分析
     *
     * @param majorHazardSource
     * @param updateTimeStart
     * @param updateTimeEnd
     * @param codeList
     * @return
     */
    LocalHazarsSourceAnalysis queryCountHazrad(@Param("majorHazardSource") String majorHazardSource, @Param("updateTimeStart") Date updateTimeStart, @Param("updateTimeEnd") Date updateTimeEnd, @Param("codeList") List<String> codeList);

    /**
     * 统计重大危险源，
     *
     * @param majorHazardSource
     * @param updateTimeStart
     * @param updateTimeEnd
     * @param codeList
     * @return
     */
    LocalHazarsSourceAnalysis queryCountHazradByGrid(@Param("majorHazardSource") String majorHazardSource, @Param("updateTimeStart") Date updateTimeStart, @Param("updateTimeEnd") Date updateTimeEnd, @Param("codeList") List<String> codeList);

    /**
     * 任务统计分析
     *
     * @param updateTimeStart
     * @param updateTimeEnd
     * @param codeList
     * @return
     */
    UserTaskAnalysis queryCountUserTask(@Param("updateTimeStart") Date updateTimeStart, @Param("updateTimeEnd") Date updateTimeEnd,
                                        @Param("codeList") List<String> codeList);

    /**
     * 任务统计，粤港专用
     *
     * @param updateTimeStart
     * @param updateTimeEnd
     * @param codeList
     * @return
     */
    UserTaskAnalysis queryCountUserTaskByGrid(@Param("updateTimeStart") Date updateTimeStart, @Param("updateTimeEnd") Date updateTimeEnd,
                                              @Param("codeList") List<String> codeList);

    /**
     * 返回某个水司下的所有子部门（只显示被下发任务的部门）任务完成率
     *
     * @param updateTimeStart
     * @param updateTimeEnd
     * @param corpCode
     * @return
     */
    List<UserTaskAnalysis> queryCountUserTaskByGridList(@Param("updateTimeStart") Date updateTimeStart, @Param("updateTimeEnd") Date updateTimeEnd,
                                                        @Param("corpCode") String corpCode);


    /**
     * 检查记录统计分析
     *
     * @param groupClass
     * @param plateClass
     * @param departmnetClass
     * @param corpClass
     * @param updateTimeStart
     * @param updateTimeEnd
     * @param codeList
     * @return
     */
    CheckRecordAnalysis queryCountCheckRecord(@Param("groupClass") String groupClass, @Param("plateClass") String plateClass,
                                              @Param("departmnetClass") String departmnetClass, @Param("corpClass") String corpClass,
                                              @Param("updateTimeStart") Date updateTimeStart, @Param("updateTimeEnd") Date updateTimeEnd,
                                              @Param("codeList") List<String> codeList);

    /**
     * 根据网格统计
     *
     * @param groupClass
     * @param plateClass
     * @param departmnetClass
     * @param corpClass
     * @param updateTimeStart
     * @param updateTimeEnd
     * @param corpCode
     * @return
     */
    List<CheckRecordAnalysis> queryCountCheckRecordListByGrid(@Param("groupClass") String groupClass, @Param("plateClass") String plateClass,
                                                              @Param("departmnetClass") String departmnetClass, @Param("corpClass") String corpClass,
                                                              @Param("updateTimeStart") Date updateTimeStart, @Param("updateTimeEnd") Date updateTimeEnd,
                                                              @Param("corpCode") String corpCode);

    AccidentBulletinAnalysis getAccidentAnalysis(Map map);

    Integer queryOperationCountByCorpAndTime(@Param("deptCodes") String deptCodes, @Param("startTime") Date startTime, @Param("endTime") Date endTime);

    DangerAnalysis getDangerByGrid(Map map);
}
